<!DOCTYPE html>

<html class="app-ui">

	<head>
		<!-- Meta -->
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />

		<!-- Document title -->
		<title>万邦-云阅卷</title>

		<meta name="description" content="AppUI - Admin Dashboard Template & UI Framework" />
		<meta name="author" content="rustheme" />
		<meta name="robots" content="noindex, nofollow" />

		<!-- Favicons -->
		<link rel="apple-touch-icon" href="assets/img/favicons/apple-touch-icon.png" />
		<link rel="icon" href="assets/img/favicons/favicon.ico" />

		<!-- Google fonts -->
		<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Roboto:300,400,400italic,500,900%7CRoboto+Slab:300,400%7CRoboto+Mono:400" />

		<!-- Page JS Plugins CSS -->
		<link rel="stylesheet" href="assets/js/plugins/slick/slick.min.css" />
		<link rel="stylesheet" href="assets/js/plugins/slick/slick-theme.min.css" />

		<!-- AppUI CSS stylesheets -->
		<link rel="stylesheet" id="css-font-awesome" href="assets/css/font-awesome.css" />
		<link rel="stylesheet" id="css-ionicons" href="assets/css/ionicons.css" />
		<link rel="stylesheet" id="css-bootstrap" href="assets/css/bootstrap.css" />
		<link rel="stylesheet" id="css-app" href="assets/css/app.css" />
		<link rel="stylesheet" id="css-app-custom" href="assets/css/app-custom.css" />
		<!-- End Stylesheets -->
	</head>

	<body class="app-ui layout-has-drawer layout-has-fixed-header" style="background-color: white;">
		<style type="text/css">
			* {
				margin: 0;
				padding: 0;
			}

			.stu-search {
				width: 200px;
				float: right;
			}

			.btn-group button {
				margin-right: 20px;
				width: 100px;
			}

			#fenjie {
				height: 15px;
				background: #f0f0f0;
			}
			
			.checkbox input {
				width: 100px;
			}
			
			thead {
				background-color: #7dc855;
			}
			
			.table {
				margin-top: 15px;
			}
			
			.table-responsive {
				text-align: center;
			}
			
			th {
				text-align: center;
				/** 设置水平方向居中 */
				vertical-align: middle
					/** 设置垂直方向居中 */
			}
		</style>
		<div class="app-layout-canvas">
			<div class="app-layout-container">

				<!-- Drawer -->
				<aside class="app-layout-drawer">

					<!-- Drawer scroll area -->
					<div class="app-layout-drawer-scroll">
						<!-- Drawer logo -->
						<div id="logo" class="drawer-header">
							<a href="index.html">
								<h4 style=" text-align:center">云阅卷</h4>
							</a>
						</div>

						<!-- Drawer navigation -->
						<nav class="drawer-main">
							<ul class="nav nav-drawer">


								<li class="nav-item nav-drawer-header">菜单导航</li>

								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-ios-calculator-outline"></i>考试管理</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="examList.html">考试列表</a>
										</li>

										<li>
											<a href="createExam.html">创建考试</a>
										</li>
									</ul>
								</li>

								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-ios-compose-outline"></i> 在线阅卷</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="examSetting.html">阅卷设置</a>
										</li>

										<li>
											<a href="examPapers.html">我要阅卷</a>
										</li>

										<li>
											<a href="examProblemPapers.html">问题卷处理</a>
										</li>
										<li>
											<a href="examProgress.html">进度监控</a>
										</li>

										<li>
											<a href="examQuality.html">质量抽查</a>
										</li>

									</ul>
								</li>


								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-ios-list-outline"></i> 成绩管理</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="examReport.html">考试成绩单</a>
										</li>

										<li>
											<a href="examSubReport.html">单科试题得分表</a>
										</li>

										<li>
											<a href="gradeAnalyze.html">年纪成绩分析</a>
										</li>

										<li>
											<a href="classAnalyze.html">班级成绩分析</a>
										</li>

									</ul>
								</li>

								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-ios-browsers-outline"></i> 教师讲卷</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="scoreAndPapers.html">成绩与答卷</a>
										</li>

										<li>
											<a href="highScoreComposition.html">高分作文</a>
										</li>

										<li>
											<a href="topicScore.html">试题得分情况</a>
										</li>

										<li>
											<a href="subAnalyzeReport.html">学科分析报表</a>
										</li>
									</ul>
								</li>

								<li class="nav-item nav-item-has-subnav">
									<a href="javascript:void(0)"><i class="ion-social-javascript-outline"></i> 用户中心</a>
									<ul class="nav nav-subnav">

										<li>
											<a href="schoolManager.html">学校管理</a>
										</li>

										<li>
											<a href="subManager.html">学科管理</a>
										</li>

										<li>
											<a href="gradeManager.html">年级管理</a>
										</li>

										<li>
											<a href="gradeAndSubManager.html">年级与学科关系维护</a>
										</li>

										<li>
											<a href="teaManager.html">教师管理</a>
										</li>

										<li>
											<a href="classManager.html">班级管理</a>
										</li>

										<li>
											<a href="stuManager.html">学生管理</a>
										</li>

										<li>
											<a href="subAdnClassAnager.html">学科与班级关系维护</a>
										</li>
									</ul>
								</li>

							</ul>
						</nav>
						<!-- End drawer navigation -->

						<div class="drawer-footer">
							<p class="copyright">Copyright &copy; 2020.北京万邦易嵌科技有限公司.<a target="_blank" href="http://www.wanbangee.com">万邦易嵌</a></p>
						</div>
					</div>
					<!-- End drawer scroll area -->
				</aside>
				<!-- End drawer -->

				<!-- Header -->
				<header class="app-layout-header">
					<nav class="navbar navbar-default">
						<div class="container-fluid">
							<div class="navbar-header">
								<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#header-navbar-collapse"
								 aria-expanded="false">
									<span class="sr-only">Toggle navigation</span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
								</button>
								<button class="pull-left hidden-lg hidden-md navbar-toggle" type="button" data-toggle="layout" data-action="sidebar_toggle">
									<span class="sr-only">Toggle drawer</span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
								</button>
								<span class="navbar-page-title">

									成绩分析
								</span>
							</div>

							<div class="collapse navbar-collapse" id="header-navbar-collapse">
								<!-- Header search form -->

								<ul class="nav navbar-nav navbar-right navbar-toolbar hidden-sm hidden-xs">
									<li>
										<!-- Opens the modal found at the bottom of the page -->
										<a href="javascript:void(0)" data-toggle="modal" data-target="#apps-modal"><i class="ion-grid"></i></a>
									</li>

									<li class="dropdown">
										<a href="javascript:void(0)" data-toggle="dropdown"><i class="ion-ios-bell"></i> <span class="badge">3</span></a>
										<ul class="dropdown-menu dropdown-menu-right">
											<li class="dropdown-header">Profile</li>
											<li>
												<a tabindex="-1" href="javascript:void(0)"><span class="badge pull-right">3</span> News </a>
											</li>
											<li>
												<a tabindex="-1" href="javascript:void(0)"><span class="badge pull-right">1</span> Messages </a>
											</li>
											<li class="divider"></li>
											<li class="dropdown-header">More</li>
											<li>
												<a tabindex="-1" href="javascript:void(0)">Edit Profile..</a>
											</li>
										</ul>
									</li>

									<li class="dropdown dropdown-profile">
										<a href="javascript:void(0)" data-toggle="dropdown">
											<span class="m-r-sm">John Doe <span class="caret"></span></span>
											<img class="img-avatar img-avatar-48" src="assets/img/avatars/avatar3.jpg" alt="User profile pic" />
										</a>
										<ul class="dropdown-menu dropdown-menu-right">
											<li class="dropdown-header">
												Pages
											</li>
											<li>
												<a href="base_pages_profile.html">Profile</a>
											</li>
											<li>
												<a href="base_pages_profile.html"><span class="badge badge-success pull-right">3</span> Blog</a>
											</li>
											<li>
												<a href="frontend_login_signup.html">Logout</a>
											</li>
										</ul>
									</li>
								</ul>
								<!-- .navbar-right -->
							</div>
						</div>
						<!-- .container-fluid -->
					</nav>
					<!-- .navbar-default -->
				</header>
				<!-- End header -->

				<main class="app-layout-content">

					<!-- Page Content -->
					<div class="container-fluid p-y-md">
						<!-- Stats -->
						<div class="row">
							<div class="col-md-12 col-lg-12">
								<h5 class="answer-detail"></h5>
								<hr />
								<div id="main-select" style="width: 600px;height:400px;"></div>
							</div>
							<!-- .col-sm-6 -->
						</div>
						<!-- .row -->
						<div id="fenjie">

						</div>
						<div class="row">
							<!-- Company overview Chart -->
							<div class="col-md-12 col-lg-12">
								<h5>主观题个人得分表</h5>
								<hr />
								<div class="form-inline col-md-8">
									筛选：

									<input id="min-score" type="text" class="form-control" placeholder="低">--
									<input id="max-score" type="text" class="form-control" placeholder="高">
									<button id="search-btn" type="button" class="btn btn-default">搜索</button>
								</div>
								<div class="col-md-4">
									<input type="text" class="form-control stu-search" placeholder="请输入姓名或学号搜索">
								</div>
							</div>
							<div class="col-md-12 col-lg-12">
								<div class="table-responsive">
									<table class="table table-hover">
										<thead class="sub-table-head">
											<th>序号</th>
											<th>学号</th>
											<th>姓名</th>
											<th>得分</th>
										</thead>
										<tbody class="stu-sub-score">

										</tbody>
									</table>
									<div class="btn-group">
										<button type="button" class="btn" id="first-page">首页</button>
										<button type="button" class="btn" id="up-page">上一页</button>
										<button type="button" class="btn" id="next-page">下一页</button>
										<button type="button" class="btn" id="last-page">尾页</button>

										<span id="fenye-info"></span>
									</div>
								</div>
							</div>
							<!-- .row -->
						</div>
						<!-- .container-fluid -->
						<!-- End Page Content -->
				</main>

			</div>
		</div>
		<!-- .app-layout-canvas -->

		<!-- Apps Modal -->
		<!-- Opens from the button in the header -->
		<div id="apps-modal" class="modal fade" tabindex="-1" role="dialog">
			<div class="modal-sm modal-dialog modal-dialog-top">
				<div class="modal-content">
					<!-- Apps card -->
					<div class="card m-b-0">
						<div class="card-header bg-app bg-inverse">
							<h4>Apps</h4>
							<ul class="card-actions">
								<li>
									<button data-dismiss="modal" type="button"><i class="ion-close"></i></button>
								</li>
							</ul>
						</div>
						<div class="card-block">
							<div class="row text-center">
								<div class="col-xs-6">
									<a class="card card-block m-b-0 bg-app-secondary bg-inverse" href="index.html">
										<i class="ion-speedometer fa-4x"></i>
										<p>Admin</p>
									</a>
								</div>
								<div class="col-xs-6">
									<a class="card card-block m-b-0 bg-app-tertiary bg-inverse" href="frontend_home.html">
										<i class="ion-laptop fa-4x"></i>
										<p>Frontend</p>
									</a>
								</div>
							</div>
						</div>
						<!-- .card-block -->
					</div>
					<!-- End Apps card -->
				</div>
			</div>
		</div>
		<!-- End Apps Modal -->

		<div class="app-ui-mask-modal"></div>

		<!-- AppUI Core JS: jQuery, Bootstrap, slimScroll, scrollLock and App.js -->
		<script src="assets/js/core/jquery.min.js"></script>
		<script src="assets/js/core/bootstrap.min.js"></script>
		<script src="assets/js/core/jquery.slimscroll.min.js"></script>
		<script src="assets/js/core/jquery.scrollLock.min.js"></script>
		<script src="assets/js/core/jquery.placeholder.min.js"></script>
		<script src="assets/js/app.js"></script>
		<script src="assets/js/app-custom.js"></script>
		<script src="assets/js/echarts.min.js"></script>

		<!-- Page Plugins -->
		<script src="assets/js/plugins/slick/slick.min.js"></script>
		<script src="assets/js/plugins/chartjs/Chart.min.js"></script>
		<script src="assets/js/plugins/flot/jquery.flot.min.js"></script>
		<script src="assets/js/plugins/flot/jquery.flot.pie.min.js"></script>
		<script src="assets/js/plugins/flot/jquery.flot.stack.min.js"></script>
		<script src="assets/js/plugins/flot/jquery.flot.resize.min.js"></script>

		<!-- Page JS Code -->
		<!-- <script src="assets/js/pages/index.js"></script> -->
		<script>
			$(function() {
				// Init page helpers (Slick Slider plugin)
				//App.initHelpers('slick');
				var examId;
				var claId;
				var subId;
				var topicNo;
				var pageNum = 1;
				var pageSize = 10;
				var total = 0;
				var totalPage = 0;
				var maxScore = 100;
				var minScore = 0;
				var stuNmOrStuNo = '';
				selectSubjectiveDistribution();
				selectStuSubjective();
				//主观题班级得分分布
				function selectSubjectiveDistribution() {
					var href = decodeURI(window.location.href); //译码
					var hrefIndex = href.split('&');
					examId = hrefIndex[0].substring(hrefIndex[0].indexOf("=") + 1);
					claId = hrefIndex[1].substring(hrefIndex[1].indexOf("=") + 1);
					subId = hrefIndex[2].substring(hrefIndex[2].indexOf("=") + 1);
					topicNo = hrefIndex[3].substring(hrefIndex[3].indexOf("=") + 1);
					$(".answer-detail").html("第"+topicNo+"题答卷详情");
					var url = "http://localhost:6630/wanbangee/exam-statistic/topicNoScoreInfo/selectSubjectiveDistribution";
					var param = {
						examId: examId,
						claId: claId,
						subId: subId,
						topicNo: topicNo
					};
					// 基于准备好的dom，初始化echarts实例
					var subjectChart = echarts.init(document.getElementById("main-select"), 'light');
					$.get(url, param, function(data) {
						var map = {};
						var seriesData = [];
						var legendData = [];
						for (var i = 0; i < data.subDistribution.length; i++) {
							map = {};
							map.name = data.subDistribution[i].StartEnd;
							map.value = data.subDistribution[i].person;
							seriesData[i] = map;
							legendData[i] = map.name;
						}
						subjectChart.setOption({
							title: {
								text: '第' + topicNo + '题班级得分分布',
								left: 'center'
							},
							tooltip: {
								trigger: 'item',
								formatter: '{a} <br/>{b} : {c}人 ({d}%)'
							},
							legend: {
								orient: 'vertical',
								left: 'left',
								data: legendData
							},
							series: [{
								name: '得分分布',
								type: 'pie',
								radius: '55%',
								center: ['50%', '60%'],
								data: seriesData,
								emphasis: {
									itemStyle: {
										shadowBlur: 10,
										shadowOffsetX: 0,
										shadowColor: 'rgba(0, 0, 0, 0.5)'
									}
								}
							}]
						})
					})
				}

				/* 主观题个人得分表 */
				function selectStuSubjective(){
					var url = "http://localhost:6630/wanbangee/exam-statistic/topicNoScoreInfo/selectStuSubjective";
					var param = {
						examId: examId,
						claId: claId,
						subId: subId,
						topicNo: topicNo,
						minScore: minScore,
						maxScore: maxScore,
						stuNmOrStuNo: stuNmOrStuNo,
						pageNum: pageNum,
						pageSize: pageSize
					}
					$.get(url,param,function(data){
						console.log(data)
						var content = "";
						for(var i=0;i<data.StuSubjectiveDetail.length;i++){
							content += "<tr><td>"+(i+1)+"</td><td>"+data.StuSubjectiveDetail[i].stuNo+"</td><td>"+data.StuSubjectiveDetail[i].stuNm+"</td><td>"+data.StuSubjectiveDetail[i].score+"</td></tr>"
						}
						$(".stu-sub-score").html(content);
						
						total = data.StuSubjectiveDetail.length;
						buttonController();
					})
				}

				/* 给学号或姓名搜索框绑定失去焦点的事件 */
				$(".stu-search").blur(function(){
					stuNmOrStuNo = $(".stu-search").val();
					selectStuSubjective();
				})
				
				/* 给搜索按钮绑定单机事件 */
				$("#search-btn").click(function(){
					minScore = $("#min-score").val();
					maxScore = $("#max-score").val();
					if(minScore == '' || minScore == null || maxScore == '' || maxScore == null){
						alert("请输入正确的筛选方式");
					}else{
						selectStuSubjective();
					}
					
				})
				
				//控制按钮的状态
				function buttonController() {
					//计算页数
					if (total % pageSize == 0) {
						totalPage = total / pageSize;
					} else {
						totalPage = parseInt(total / pageSize) + 1;
					}
					if(total == 0){
						totalPage = 1;
					}
					//显示分页信息
					$("#fenye-info").html(total + "笔数据，共" + totalPage + "页，当前显示第" + pageNum + "页");
					//控制按钮状态
					$("#first-page").prop("disabled", false);
					$("#up-page").prop("disabled", false);
					$("#next-page").prop("disabled", false);
					$("#last-page").prop("disabled", false);
					if (pageNum == 1 && totalPage > 1) {
						$("#first-page").prop("disabled", true);
						$("#up-page").prop("disabled", true);
					} else if (pageNum == 1 && totalPage == 1) {
						$("#first-page").attr("disabled", true);
						$("#up-page").prop("disabled", true);
						$("#next-page").prop("disabled", true);
						$("#last-page").prop("disabled", true);
					} else if (pageNum == totalPage) {
						$("#next-page").prop("disabled", true);
						$("#last-page").prop("disabled", true);
					} else if(total == 0){
						$("#first-page").attr("disabled", true);
						$("#up-page").prop("disabled", true);
						$("#next-page").prop("disabled", true);
						$("#last-page").prop("disabled", true);
					}
				}
				
				//给分页按钮绑定单击事件
				$("#first-page").click(function() {
					pageNum = 1;
					selectStuSubjective();
				});
				$("#up-page").click(function() {
					pageNum = pageNum - 1;
					selectStuSubjective();
				});
				$("#next-page").click(function() {
					pageNum = pageNum + 1;
					selectStuSubjective();
				});
				$("#last-page").click(function() {
					pageNum = totalPage;
					selectStuSubjective();
				});
			});
		</script>

	</body>

</html>
